<?php

namespace App\Providers;

use App\Common\SDK\Domain\BaiDu;
use App\Common\SDK\Domain\FenZhangTong;
use App\Common\SDK\Domain\ShanDe;
use App\Common\SDK\Domain\ZhiLing;
use App\Common\SDK\Domain\ChinaUms;
use GuzzleHttp\Client;
use Illuminate\Support\ServiceProvider;

class SDKServiceProvider extends ServiceProvider
{
    public function boot()
    {

    }

    public function register()
    {
        $this->app->singleton('ZhiLing', function () {
            return (new ZhiLing())->setHttpClient(new Client(['base_uri' => env('ZHI_LING_BASE_URI')]));
        });
        $this->app->singleton('FenZhangTong', function () {
            return (new FenZhangTong())->setHttpClient(new Client(['base_uri' => env('FEN_ZHANG_TONG_BASE_URI')]));
        });
        $this->app->singleton('ShanDe', function () {
            return (new ShanDe())->setHttpClient(new Client(['base_uri' => env('SHAN_DE_BASE_URI')]));
        });
        $this->app->singleton('BaiDu', function () {
            return (new BaiDu())->setHttpClient(new Client(['base_uri' => env('BAI_DU_BASE_URI')]));
        });
        //yang
        $this->app->singleton('ChinaUms', function () {
            return (new ChinaUms())->setHttpClient(new Client(['base_uri' => env('CHINA_UMS_BASE_URI')]));
        });

        $this->app->alias('ZhiLing', \App\Common\SDK\Facade\ZhiLing::class);
        $this->app->alias('FenZhangTong', \App\Common\SDK\Facade\FenZhangTong::class);
        $this->app->alias('BaiDu', \App\Common\SDK\Facade\BaiDu::class);
        $this->app->alias('ShanDe', \App\Common\SDK\Facade\ShanDe::class);
        $this->app->alias('ChinaUms', \App\Common\SDK\Facade\ChinaUms::class);
    }
}
